#include "stdafx.h"
#include "IpLayer.h"

CIPLayer::CIPLayer(char *pName)
	:CBaseLayer(pName)
{
}

BOOL CIPLayer::Receive(unsigned char* ppayload)
{
	PIp_Header pFrame = (PIp_Header) ppayload ;
	
	BOOL bSuccess = mp_aUpperLayer[0]->Receive( (unsigned char*) pFrame->Ip_data);
	return bSuccess;
}
BOOL CIPLayer::Send(unsigned char* ppayload, int length)
{
	memcpy( m_ipHeader.Ip_data, ppayload, length ) ;

	BOOL bSuccess = mp_UnderLayer->Send( (unsigned char*)&m_ipHeader, length + IP_HEADER_SIZE );


	return bSuccess ;
}